<?php namespace testsacvoyage;

require_once 'sacvoyage/autoload.php';
spl_autoload_register('sacvoyage\autoload');

use \PHPUnit_Framework_TestCase;

require_once 'sacvoyage/storage/Gateway.php';
use sacvoyage\storage\Gateway;



abstract class AbstractTest extends PHPUnit_Framework_TestCase {


	public function resetDatabase() {
		$result=$this->getGateway()->query('SHOW TABLES');
		while($row=$result->fetch_row()) {
			$this->getGateway()->query("drop table {$row[0]}");
		}
		$result->free();
	}


	private $_gateway;
	public function getGateway() {		
		if(!$this->_gateway) {
			$this->_gateway=new Gateway(
				'localhost', 
				'test_sacvoyage', 
				'test_sacvoyage', 
				'123'
			);
		}	
		return $this->_gateway;
	}


}

?>
